﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Moving03.Services
{
    /// <summary>
    /// Summary description for WSNoiDi
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class WSNoiDi : System.Web.Services.WebService
    {
        DataClasses1DataContext context = new DataClasses1DataContext();
        [WebMethod]
        public classThongTinNoiDi thongTinNoiDi(int maNoiDi)
        {
            classThongTinNoiDi noidi = new classThongTinNoiDi();
            NoiDi nd = context.NoiDis.Single(p => p.Id_Noidi == maNoiDi);
            noidi.Email = nd.Email;
            noidi.DiaChi = nd.Diachi;
            noidi.DienThoai = nd.Dienthoai;
            noidi.MaBuuDien = nd.Mabuudien.ToString();
            noidi.NguoiGoi = nd.NguoiGoi;
            noidi.ThanhPho = nd.Thanhpho;
            DanhSachQuocGia qg = context.DanhSachQuocGias.Single(p => p.Id_MaQGia == nd.Id_Quocgia);
            noidi.QuocGia = qg.TenQuocGia;
            return noidi;
        }
    }
}
